/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.platformservice.persistence.derivative;

import org.proteusframework.platformservice.persistence.messagebean.DataType;

/**
 * Specific derivative converter capable of turning the object value of the given data type into a format suitable
 * for use within the context of the derivative. For example, the <code>JDBCDerivativeConverter</code> knows how to
 * convert a specific value with a given data type into a format suitable for use within the context of a
 * <code>PreparedStatement</code>.
 *
 * @author Tacoma Four
 */
public interface IDerivativeConverter<T>
{
    /**
     * Perform a derivative conversion
     *
     * @param targetDerivative Target derivation
     * @param dataType         Data type of the given value
     * @param value            Value to be converted
     * @param parameters       Contextual parameters specific to a given <code>IDerivativeConverter</code> instance
     */
    void convert(T targetDerivative, DataType dataType, Object value, Object... parameters);
}
